# -*- coding:UTF-8 -*-
'''
开发环境：PyCharm
创建日期：2025/8/7 10:51
作   者：新启典学苑-樱桃
描   述：键盘事件都在Keys模块中定义的
'''
from time import sleep

from selenium import webdriver
from selenium.webdriver import Keys
from selenium.webdriver.common.by import By

driver = webdriver.Edge()  # 创建edge浏览器对象
driver.get("http://www.baidu.com")

# 输入搜索的内容，点击回车，也能搜索
a = driver.find_element(By.ID, "kw")
# a.send_keys("hello world")
# a.send_keys(Keys.ENTER) # 点击回车
# sleep(1)
# a.send_keys(Keys.CONTROL, "a") # 全选
# a.send_keys(Keys.CONTROL, "c") # 复制
# a.send_keys(Keys.CONTROL, "v") # 粘贴
# a.send_keys(Keys.CONTROL, "v") # 粘贴
# a.send_keys(Keys.CONTROL, "v") # 粘贴
a.click()
# a.send_keys(Keys.CONTROL, Keys.SHIFT, "i")
# a.send_keys(Keys.ENTER)
sleep(100)
